home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14002 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  50 lines

  1. Newsgroups: comp.lang.c
  2. Path: gail.ripco.com!mambuhl
  3. From: mambuhl@ripco.com (Martin Ambuhl)
  4. Subject: Re: Question on pointers 
  5. Message-ID: <DpotxK.6MC@rci.ripco.com>
  6. X-Nntp-Sender: mambuhl@cook.ripco.com
  7. Sender: usenet@rci.ripco.com (Net News Admin)
  8. Organization: Ripco Internet BBS Chicago
  9. Date: Thu, 11 Apr 1996 07:53:44 GMT
  10.  
  11. ebromber@forest.drew.edu in <1996Apr8.233330.139449@forest> asks:
  12.  
  13. >In a program there is an array of structs. One of the headers for a
  14. >function says void pop(stack *).
  15.                                 ^^
  16.                                 Should be ';'
  17.  
  18. >My question is shouldn't there be a name
  19. >or identifier after the asterisk?
  20.  
  21.         No.  This is a prototype telling the compiler that pop is a
  22.         function taking an argument of type `stack *' and returning
  23.         nothing.
  24.  
  25. >My friend says that it is the address of
  26. >a stack in the array.
  27.  
  28.         This is meaningless.
  29.  
  30. >If this is true, how could I access the thing
  31. >pointed to?
  32.  
  33.         By dereferencing the pointer.
  34.  
  35. >Here are some lines which define a stack
  36.  
  37. >typedef struct item item;
  38. >struct item {
  39. >        struct item *next;
  40. >        char c;
  41. >        }
  42.          ^^^
  43.          missing ';'
  44. >typedef item *stack;
  45.  
  46.                   
  47. --
  48. * Martin Ambuhl       net: mambuhl@ripco.com
  49. * Chicago, IL (USA)    
  50.